home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / Sources / Configure < prev    next >
Encoding:
Text File  |  1996-09-27  |  39.7 KB  |  1,812 lines

  1. #!/bin/sh
  2.  
  3. #{{{}}}
  4. #{{{  text variables
  5. MAIN_LIMIT="==============================================================================="
  6. SUB_LIMIT="-------------------------------------------------------------------------------"
  7. #}}}
  8. #{{{  maybe show help
  9. if test x$1 = x-h
  10. then
  11.    cat <<\HERE
  12. Configure [m4-name]
  13.  
  14. Prompts for the wished configuration and generates:
  15.  
  16.    File        - Configfile
  17.    Directory    - scripts
  18.    shell-script    - scripts/*
  19.  
  20. #{{{  The following defines can be used:
  21. #{{{  general
  22.  CR_LF_MSG    ascii file use cr and lf between lines!
  23.  OS_MOUSE_xxx    additional mouse ports, see os.h for more details
  24.  TERMINFO    use terminfo database instead of termcap
  25.      INC_CURSES
  26.         include curses.h for terminfo stuff
  27.      INC_TERM    include term.h for terminfo stuff
  28.  SMALL_TERMINFO
  29.         restricted number of key entries known
  30.  NO_GETOPT_H    don't include getopt.h (already known in stdlib.h,..?)
  31. #}}}
  32. #{{{  origami
  33.  AUTOSAVE_FILE    specify the name of the file, which is used for auto-save.
  34.         Will be removed at end of editing session
  35.  CONFIG_H    include file "config.h" in front of each origami source file.
  36.  ORIGAMI_RC_PATH
  37.         defines the directories, which are used to look for the rc/help
  38.         files.
  39.  FILEC        allow filename completion in text and prompts
  40.  REGEXP        allow regular expression search and replace
  41.    REG_COMP_BUFF
  42.         -DREG_COMP_BUFF=x stores up to x compiled regular
  43.         expressions and the corresponding search strings
  44.  SECURE        -DSECURE=\"xxx\" command line option -S xxx is used in general!
  45.  DEFAULT_TERM    use this value, if $TERM cannot be read.
  46.  DIREDT    editing directories calls dirfold and the text is the output
  47.         of dirfold -ls
  48.    DIR_CMD    replace the dirfold command by another one.
  49.  VARARGS    if your system is screwed up with varargs
  50.  NO_MSG        to avoid the copyright message startup - for personal use only!
  51.  SW_MSG        message can be switched of by a command line option
  52.  DOC_MSG    to enable the reference to the doc directory in the copyright
  53.  PORTER        text in copyright message, to show author of current port
  54.  VIRTUAL    use code to store lines of text in a file
  55.  DEFAULT_FILE    if no filename is given on command line, use this one
  56.  ALWAYS_START    if no filename is given on commandline, if no DEFAULT_FILE
  57.         is given and the empty file is given in the prompt, use
  58.         /dev/null as file!
  59.  NOSYSEXIT    -DNOSYSEXIT enables the lokal definition of the standard unix
  60.         exit codes. All following standard exit-codes can be  redefined
  61.         with -DSYMBOL=xx too:
  62.             EX_OK        ( default:   0    )
  63.             EX_USAGE        ( default:  64    )
  64.             EX_DATAERR        ( default:  65    )
  65.             EX_NOINPUT        ( default:  66    )
  66.             EX_UNAVAILABLE    ( default:  69    )
  67.             EX_SOFTWARE        ( default:  70    )
  68.             EX_OSERR        ( default:  71    )
  69.             EX_CANTCREAT    ( default:  73    )
  70.         If there are no -DSYMBOL=xx definitions,  the  above  mentioned
  71.         defaults are used.
  72.  ORIEXITBASE    -DORIEXITBASE=xx sets the startvalue for the non-standard exit
  73.         codes to xx (default is 1). Origami uses the values  xx,xx+1,..
  74.         for its non-standard exits.
  75.  MALLOC_DEBUG    enable compilation of malloc debug routines
  76.  OCL_DEBUG    enable compilation of ocl-macro debug routines
  77.  VIR_DEBUG    enable compilation of virtual line handling debug routines
  78.  UNSIGNED_FUNC    use functions for strcpy... for stronger typ checking
  79.  RC_BUFFER_SIZE use -DRC_BUFFER_SIZE=xx to specify a new buffer size for
  80.         stdio read for rc-file. default and minimum is BUFSIZE (as
  81.         defined in stdio.h.
  82.         On systems not supporting 'setvbuf', do not define
  83.         RC_BUFFER_SIZE but define setvbuf to setbuf!
  84.  NOMEMDUMP    -DNOMEMDUMP=xx try to dump current file if memory full
  85.         xx is the size of a malloced buffer, freed before dumping!
  86.         (needs sep. stack & heap machines)
  87.  NO_MAIL    -DNO_MAIL don't use the default mail mechanism to send
  88.         information about dumped files. You can define your own macros.
  89.         see h/os.h and origami/loop.c for details.
  90.  MAIL_SENDMAIL    -DMAIL_SENDMAIL=xxx, use xxx directly as sendmail. Do not
  91.         use mail/mail -s
  92.  NO_MAIL_S    -DMAIL_NO_S suppresses the usage of -s for a oricore-mail
  93.         Origami uses "mail [-s 'subject'] user" to send the mail
  94.  MAILCMD    -DMAILCMD(c,s)=xxx replaces the default mail commandstring
  95.         with xxx, shown above
  96.           c is the buffer for the string
  97.           s is the subject
  98.         returns empty string on error (cannot get user, ...)
  99.  MAILCMDSIZE    length of the mail command string (default is 256)
  100.  MOUSY        use code for mouse preparation (see doc/MOUSY!), set by XTERM
  101.         and MGR
  102.  MGR        enable the support for mgr-mouse
  103.  XTERM        enable the support for xterm-mouse-usage
  104.         Xterm is send the escape-sequence, to send mouse-position
  105.         on 'button-pressed'.
  106.    XTERM_START_BP    -DXTERM_START_BP=xx
  107.             sets the string, to activate sending the position, default
  108.             is "\033[?9h"
  109.    XTERM_END_BP    -DXTERM_END_BP=xx
  110.             sets the string, to deactivate sending the position,
  111.             default is "\033[?9l".
  112.    XTERM_MOUSE_CODE
  113.              -DXTERM_MOUSE_CODE=xx sets the answering header, which is
  114.              followed by button,x and y-position, default is "\033[M".
  115.    XTERM_MOUSE_LG
  116.             -DXTERM_MOUSE_LG=xx sets the  length  of  XTERM_MOUSE_CODE,
  117.             default is 3.
  118.    XTERM_CHGNAME   sets the c-source to change the windowname. Default is
  119.             sending esc ] 0 ; <name> bel to stdout.
  120.    XTERM_DEFAULT_TITLE
  121.             specifies the name, origami set the window tile on exiting,
  122.             if -T is used without another name
  123.    XTERM_GET_SIZE
  124.             defines the string, send to xterm to get the windowsize.
  125.             default is: "\0337\033[r\033[999;999H\033[6n\0338"
  126.    XTERM_SIZE_HEAD
  127.             start of respond for ^, default is"\033["
  128.    XTERM_SIZE_MID
  129.             limiter between lines/columns for ^, default is ";"
  130.    XTERM_SIZE_END
  131.             end of ^, default is "R"
  132.   RC_OS_EXT_HANDLE
  133.         hook for handling port specific options
  134.   OWN_ARG_USAGE_SHORT
  135.         argument string for short help display of -X
  136.   OWN_ARG_USAGE_LONG
  137.         description string for help display of -X
  138.   OS_FILEPROMPT
  139.         use a new routine for reading filenames (filerequester!)
  140.   USE_SCR_BUFF    enable the compilation of a double buffering screen
  141.         handling mechanism. scrbuff.o must be in ADD_ORI_FILES
  142.   fl_overwrite    this routine can be redefined to use a fast algorithm to
  143.         print a sequence of chars on one line. Terminal code like
  144.         tputs is not used for this!
  145.   BLOCK_FLUSH  don't use delete insert char...
  146.         Rewrite diff parts of the screen
  147.   USER_SIGNAL  os specific interrupt handler, which should call ori_abort,
  148.         if a interrupt is needed.
  149.  
  150.  The following switches can be used to compile Origami on systems, where some
  151.  library functions are not supported:
  152.  
  153.  ADD_ORI_FILES (make variable)
  154.         The names of additional c-source files, which must be  compiled
  155.         and linked with origami.
  156.  USEGETHOSTNAME do not use uname but gethostname
  157.  GETPWENT_MIS    missing prototyp for getpwent
  158.  NO_GETPWENT    Don't use getpwent for user-completion
  159.         look user id's 0..31 instead
  160.   UID_START_GETPWENT
  161.   UID_END_GETPWENT
  162.         use other start/end values for simulated getpwend
  163.  NO_ENDPWENT    Don't use endpwent to end the expansion  of  ~.  Use  only  the
  164.         POSIX command getpwnam.
  165.  USLEEP_MIS    Set this, if your system has no usleep command.  In  this  case
  166.         the file usleep.o must  be  in  the  ADD_ORI_FILES  definition!
  167.         Choose on of the following simulations:
  168.   SELECT_USLEEP    usleep(x)->sleep(x/1000000);select(dummy,x%1000000);
  169.             tested with    SUNOS_GCC,SUNOS_UNPROTO_CC,
  170.                     HPUX_ANSInHPUX_UNPROTO
  171.   POLL_USLEEP         usleep(x)->sleep(x/1000000);poll(dummy,x*1000);
  172.             tested with    SUNOS_GCC,SUNOS_UNPROTO_CC
  173.   BUSY_USLEEP        usleep(x)->sleep(x/1000000);busy-wait(x%1000000);
  174.                               ( using gettimeofday! )
  175.             tested with    SUNOS_GCC,SUNOS_UNPROTO_CC,
  176.                     HPUX_ANSI,HPUX_UNPROTO
  177.         If no of the above is used, usleep is replaced in the following
  178.         way:
  179.             usleep(x)->sleep(x/1000000);if (x%100000) sleep(1);
  180.  POPEN_MIS    Define a prototyp for popen
  181.  PCLOSE_MIS    Define a prototyp for pclose
  182.  STRERROR_MIS    Set this, if you system  has  no  strerror  command.  The  file
  183.         strerror.o must be in the ADD_ORI_FILES definition
  184. #}}}
  185. #{{{  keybind
  186.  DEFAULT_MOUSE    -DDEFAULT_MOUSE=xxx sets the mouse-support, which is activated
  187.         in keybind without any -M.. option.  The default is: xterm,
  188.         if possible else mgr, if possible else ""
  189.  MAC_BUFF_SIZE    size of the buffer for collecting "deffun's"
  190.         default is 0, so all deffun's are writtenn directly
  191.  NO_OPTI    don't compile the OCL_optimizer
  192.  OS_TOKEN    specify additional token, recognizid by the scanner
  193.         -DOS_TOKEN=foo,
  194.  OS_KB_NAMES    specify names for OS_TOKEN
  195.         -DOS_KB_NAMES={"name-for-foo","foo"},
  196.  OS_VARS
  197.  SETBUFF    -DSETBUF(fp)=xxx
  198.         specify function to set buffer size for FILE* to new value
  199.  STD_FILTER    specify filter, which is used to read all ocl-sources
  200.  STD_TOP_FILTER    specify filter, which is used to read top ocl-source file
  201. #}}}
  202. #}}}
  203. HERE
  204.    exit
  205. fi
  206. #}}}
  207. #{{{  init m4 from commandline
  208. M4=$1
  209. #}}}
  210.  
  211. #{{{  create directory for automatically generated scripts
  212. SCRIPT_DIR="`pwd`/scripts"
  213. M4FLAGS="-DSCRIPT_DIR=$SCRIPT_DIR"
  214. if test -d scripts
  215. then
  216.    :
  217. else
  218.    mkdir scripts
  219.    chmod 755 scripts
  220. fi
  221. #}}}
  222. #{{{  set scripts to not needed
  223. INSTALL_DIR=0
  224. INSTALL_FILE=0
  225. INSTALL_BIN=0
  226. #}}}
  227.  
  228. #{{{  intro
  229. echo 'Hi, to configure this package you will have to answer a few questions.'
  230. echo ''
  231. #}}}
  232.  
  233. #{{{  OS
  234. #{{{  ask for OS
  235. echo $MAIN_LIMIT
  236. echo '1) Linux, using gcc >=2.4.5, lib >=4.4.4'
  237. echo '2) SunOS 4.1.2'
  238. echo '3) HP-UX A.B 8.07 A'
  239. echo '4) SNI s600-20 uxpm'
  240. echo '5) DEC Alpha OSF/1'
  241. echo ''
  242. echo 'What'\''s your OS? '
  243. read OS
  244. echo ''
  245. #}}}
  246. case $OS in
  247. #{{{  linux
  248.   1)
  249.   if test x$M4 = x
  250.   then
  251.      M4=m4
  252.   fi
  253.   M4FLAGS="$M4FLAGS -Dlinux -Dscrbuff -DM4=$M4"
  254. #{{{  awk
  255.   AWK=awk
  256.   M4FLAGS="$M4FLAGS -DAWK=$AWK"
  257. #}}}
  258.   ;;
  259. #}}}
  260. #{{{  sunos
  261.   2)
  262.   if test x$M4 = x
  263.   then
  264.      M4=/usr/5bin/m4
  265.   fi
  266.   M4FLAGS="$M4FLAGS -Dsunos -Dscrbuff -DM4=$M4"
  267. #{{{  compiler
  268. #{{{  ask for compiler
  269.   echo $SUB_LIMIT
  270.   echo '1) GCC 2.2.1'
  271.   echo '2) Native compiler and unproto'
  272.   echo ''
  273.   echo 'Which compiler do you want to use? '
  274.   read COMPILER
  275.   echo ''
  276. #}}}
  277.   case $COMPILER in
  278. #{{{  gcc
  279.     1)
  280.     M4FLAGS="$M4FLAGS -Dgcc"
  281.     ;;
  282. #}}}
  283. #{{{  native
  284.     2)
  285.     M4FLAGS="$M4FLAGS -Dnative -Dansi2kr -DUNPROTO=unproto"
  286.     ;;
  287. #}}}
  288. #{{{  *)
  289.     *)
  290.     echo 'Invalid answer, bye :('; exit 1
  291.     ;;
  292. #}}}
  293.   esac
  294. #}}}
  295. #{{{  terminfo
  296. #{{{  ask for terminfo
  297.   echo $SUB_LIMIT
  298.   echo '1) termcap'
  299.   echo '2) terminfo'
  300.   echo '3) terminfo, adding /usr/5include and /usr/5lib to include and link path'
  301.   echo ''
  302.   echo 'Which terminal database do you want to use? '
  303.   read TERMCAP_USE
  304.   echo ''
  305. #}}}
  306.   case $TERMCAP_USE in
  307. #{{{  terminfo
  308.     2)
  309.     M4FLAGS="$M4FLAGS -Dterminfo"
  310.     ;;
  311. #}}}
  312. #{{{  terminfo 5
  313.     3)
  314.     M4FLAGS="$M4FLAGS -Dterminfo -Dsunos_term_SYSV"
  315.     ;;
  316. #}}}
  317.   esac
  318. #}}}
  319. #{{{  awk
  320. #{{{  ask for AWK
  321.   echo $SUB_LIMIT
  322.   echo '1) awk'
  323.   echo '2) mawk'
  324.   echo '3) gawk'
  325.   echo ''
  326.   echo 'Which awk do you want (number or enter command)? '
  327.   read AWK
  328.   echo ''
  329. #}}}
  330.   case $AWK in
  331. #{{{  1
  332.     1)
  333.     AWK=awk
  334.     ;;
  335. #}}}
  336. #{{{  2
  337.     2)
  338.     AWK=mawk
  339.     ;;
  340. #}}}
  341. #{{{  3
  342.     3)
  343.     AWK=gawk
  344.     ;;
  345. #}}}
  346. #{{{  *)
  347.     *)
  348.     ;;
  349. #}}}
  350.   esac
  351.   M4FLAGS="$M4FLAGS -DAWK=$AWK"
  352. #}}}
  353.   ;;
  354. #}}}
  355. #{{{  hp-ux
  356.   3)
  357.   if test x$M4 = x
  358.   then
  359.      M4=m4
  360.   fi
  361.   M4FLAGS="$M4FLAGS -Dhpux -Dscrbuff -DM4=$M4"
  362. #{{{  missing install command
  363.   INSTALL_DIR=1
  364.   INSTALL_FILE=1
  365.   INSTALL_BIN=1
  366. #}}}
  367. #{{{  compiler
  368. #{{{  ask for compiler
  369.   echo $SUB_LIMIT
  370.   echo '1) GCC 2.1'
  371.   echo '2) Native ANSI compiler'
  372.   echo '3) Native k&r compiler and unproto'
  373.   echo ''
  374.   echo 'Which compiler do you want to use? '
  375.   read COMPILER
  376.   echo ''
  377. #}}}
  378.   case $COMPILER in
  379. #{{{  gcc
  380.     1)
  381.     M4FLAGS="$M4FLAGS -Dgcc"
  382.     ;;
  383. #}}}
  384. #{{{  native_ansi
  385.     2)
  386.     M4FLAGS="$M4FLAGS -Dnative_ansi"
  387.     ;;
  388. #}}}
  389. #{{{  native
  390.     3)
  391.     M4FLAGS="$M4FLAGS -Dnative -Dansi2kr -DUNPROTO=unproto"
  392.     ;;
  393. #}}}
  394.   esac
  395. #}}}
  396. #{{{  terminfo
  397. #{{{  ask for terminfo
  398.   echo $SUB_LIMIT
  399.   echo '1) termcap'
  400.   echo '2) terminfo'
  401.   echo ''
  402.   echo 'Which terminal database do you want to use? '
  403.   read TERMCAP_USE
  404.   echo ''
  405. #}}}
  406.   case $TERMCAP_USE in
  407. #{{{  terminfo
  408.     2)
  409.     M4FLAGS="$M4FLAGS -Dterminfo"
  410.     ;;
  411. #}}}
  412.   esac
  413. #}}}
  414. #{{{  awk
  415. #{{{  ask for AWK
  416.   echo $SUB_LIMIT
  417.   echo '1) awk'
  418.   echo '2) mawk'
  419.   echo '3) gawk'
  420.   echo ''
  421.   echo 'Which awk do you want (number or enter command)? '
  422.   read AWK
  423.   echo ''
  424. #}}}
  425.   case $AWK in
  426. #{{{  1
  427.     1)
  428.     AWK=awk
  429.     ;;
  430. #}}}
  431. #{{{  2
  432.     2)
  433.     AWK=mawk
  434.     ;;
  435. #}}}
  436. #{{{  3
  437.     3)
  438.     AWK=gawk
  439.     ;;
  440. #}}}
  441. #{{{  *)
  442.     *)
  443.     ;;
  444. #}}}
  445.   esac
  446.   M4FLAGS="$M4FLAGS -DAWK=$AWK"
  447. #}}}
  448.   ;;
  449. #}}}
  450. #{{{  sni s600-20 uxpm
  451.   4)
  452.   if test x$M4 = x
  453.   then
  454.      M4=m4
  455.   fi
  456.   M4FLAGS="$M4FLAGS -Dsni_s600_20_uxpm -DM4=$M4"
  457. #{{{  awk
  458. #{{{  ask for AWK
  459.   echo $SUB_LIMIT
  460.   echo '1) awk'
  461.   echo '2) mawk'
  462.   echo '3) gawk'
  463.   echo ''
  464.   echo 'Which awk do you want (number or enter command)? '
  465.   read AWK
  466.   echo ''
  467. #}}}
  468.   case $AWK in
  469. #{{{  1
  470.     1)
  471.     AWK=awk
  472.     ;;
  473. #}}}
  474. #{{{  2
  475.     2)
  476.     AWK=mawk
  477.     ;;
  478. #}}}
  479. #{{{  3
  480.     3)
  481.     AWK=gawk
  482.     ;;
  483. #}}}
  484. #{{{  *)
  485.     *)
  486.     ;;
  487. #}}}
  488.   esac
  489.   M4FLAGS="$M4FLAGS -DAWK=$AWK"
  490. #}}}
  491.   ;;
  492. #}}}
  493. #{{{  description_alpha_axp_osf_1
  494.   5)
  495.   if test x$M4 = x
  496.   then
  497.      M4=m4
  498.   fi
  499.   M4FLAGS="$M4FLAGS -Ddec_alpha_axp_osf_1 -Dscrbuff -DM4=$M4"
  500. #{{{  missing install command
  501.   INSTALL_DIR=1
  502.   INSTALL_FILE=1
  503.   INSTALL_BIN=1
  504. #}}}
  505. #{{{  compiler
  506. #{{{  ask for compiler
  507.   echo $SUB_LIMIT
  508.   echo '1) GCC 2.3.3 (not tested)'
  509.   echo '2) DEC OSF/1 C compiler'
  510.   echo ''
  511.   echo 'Which compiler do you want to use? '
  512.   read COMPILER
  513.   echo ''
  514. #}}}
  515.   case $COMPILER in
  516. #{{{  gcc
  517.     1)
  518.     M4FLAGS="$M4FLAGS -Dgcc"
  519.     ;;
  520. #}}}
  521. #{{{  native
  522.     2)
  523.     M4FLAGS="$M4FLAGS -Dnative"
  524.     ;;
  525. #}}}
  526. #{{{  *)
  527.     *)
  528.     echo 'Invalid answer, bye :('; exit 1
  529.     ;;
  530. #}}}
  531.   esac
  532. #}}}
  533. #{{{  awk
  534. #{{{  ask for AWK
  535.   echo $SUB_LIMIT
  536.   echo '1) awk'
  537.   echo '2) gawk'
  538.   echo ''
  539.   echo 'Which awk do you want (number or enter command)? '
  540.   read AWK
  541.   echo ''
  542. #}}}
  543.   case $AWK in
  544. #{{{  1
  545.     1)
  546.     AWK=awk
  547.     ;;
  548. #}}}
  549. #{{{  2
  550.     2)
  551.     AWK=gawk
  552.     ;;
  553. #}}}
  554. #{{{  *)
  555.     *)
  556.     ;;
  557. #}}}
  558.   esac
  559.   M4FLAGS="$M4FLAGS -DAWK=$AWK"
  560. #}}}
  561.   ;;
  562. #}}}
  563. #{{{  *)
  564.   *)
  565.   echo 'Invalid answer, bye :('; exit 1
  566.   ;;
  567. #}}}
  568. esac
  569. #}}}
  570. #{{{  some internal test
  571. echo $MAIN_LIMIT
  572. echo ''
  573. echo "please wait, checking some internals"
  574. echo ''
  575. #{{{  check, if m4 is available
  576. if ($M4 </dev/null)
  577. then
  578.   :
  579. else
  580. #{{{  abort
  581.   echo 'Eeeek, you don'\''t have '$M4'! You will have to install it first, bye.'
  582.   exit 1
  583. #}}}
  584. fi
  585. #}}}
  586. #{{{  check, if awk is available
  587. if ($AWK '{}' </dev/null)
  588. then
  589.   :
  590. else
  591. #{{{  abort
  592.   echo 'Eeeek, you don'\''t have '$AWK'! You will have to install it first, bye.'
  593.   exit 1
  594. #}}}
  595. fi
  596. #}}}
  597. #{{{  check for mkdep
  598. if (mkdep -h >/dev/null 2>/dev/null)
  599. then
  600.   M4FLAGS="$M4FLAGS -Dmkdep"
  601. else
  602.   echo "if you cannot use gcc or makedepend for dependency-generation, use"
  603.   echo ''
  604.   echo "          make pseudo_depend"
  605.   echo ''
  606. fi
  607. #}}}
  608. #}}}
  609. #{{{  mgr
  610. #{{{  ask for MGR
  611. echo $MAIN_LIMIT
  612. echo '1) No MGR support'
  613. echo '2) Support Bellcore Window Manager MGR (/usr/mgr)'
  614. echo '3) Support Bellcore Window Manager MGR ('$HOME'/mgr)'
  615. echo ''
  616. echo 'Do you want Origami to support MGR (number or path for local mgr directory)? '
  617. read MGR
  618. echo ''
  619. #}}}
  620. case $MGR in
  621. #{{{  1
  622.   1)
  623.   ;;
  624. #}}}
  625. #{{{  2
  626.   2)
  627.   M4FLAGS="$M4FLAGS -DMGR -DMGRDIR=/usr/mgr"
  628.   ;;
  629. #}}}
  630. #{{{  3
  631.   3)
  632.   M4FLAGS="$M4FLAGS -DMGR -DMGRDIR=$HOME/mgr"
  633.   ;;
  634. #}}}
  635. #{{{  *)
  636.   *)
  637.   M4FLAGS="$M4FLAGS -DMGR -DMGRDIR=$MGR"
  638.   ;;
  639. #}}}
  640. esac
  641. #}}}
  642. #{{{  install directories
  643. #{{{  WHEREHOME
  644. #{{{  show explanation for paths
  645. echo $MAIN_LIMIT
  646. echo 'Where shall Origami'\''s support files live ?'
  647. echo 'Needed are the following information:'
  648. echo ''
  649. echo ' 1 - the path, the files should be moved to, during installation'
  650. echo ' 2 - the path, the files are accessed during usage'
  651. echo ''
  652. echo 'This makes it possible, to install the paket with a temporary name'
  653. echo 'and move it to the right place, or install it on a net-server with'
  654. echo 'a complete other pathname!'
  655. echo ''
  656. #}}}
  657. #{{{  ask for WHEREHOME
  658. echo $SUB_LIMIT
  659. echo '1) /usr/origami'
  660. echo '2) '$HOME'/origami'
  661. echo ''
  662. echo 'Enter the path, the files should be moved to (number or other path)? '
  663. read WHERE
  664. echo ''
  665. #}}}
  666. case $WHERE in
  667. #{{{  /usr/origami
  668.   1)
  669.   ORIPATH="/usr/origami"
  670.   ;;
  671. #}}}
  672. #{{{  $HOME/origami
  673.   2)
  674.   ORIPATH="$HOME/origami"
  675.   ;;
  676. #}}}
  677. #{{{  *)
  678.   *)
  679.   ORIPATH="$WHERE"
  680.   ;;
  681. #}}}
  682. esac
  683. #{{{  ask for ACCESSHOME
  684. echo $SUB_LIMIT
  685. echo 'Enter the path, used during usage, empty path will use '$ORIPATH'. ->'
  686. read ACCESSHOME
  687. echo ''
  688. #}}}
  689. case x$ACCESSHOME in
  690. #{{{  
  691.   x)
  692.   ACCESSHOME=$ORIPATH
  693.   ;;
  694. #}}}
  695. #{{{  *)
  696.   *)
  697.   ;;
  698. #}}}
  699. esac
  700. M4FLAGS="$M4FLAGS -DWHEREHOME=$ORIPATH -DACCESSHOME=$ACCESSHOME"
  701. #}}}
  702. #{{{  WHEREBIN
  703. #{{{  info about 2 paths
  704. echo $MAIN_LIMIT
  705. echo 'Like install directory, two paths are needed for the binaries!'
  706. echo ''
  707. #}}}
  708. #{{{  ask for WHEREBIN
  709. echo $SUB_LIMIT
  710. echo '0) '$ORIPATH'/bin'$ARCHITECTURE
  711. echo '1) /lbin'
  712. echo '2) /usr/bin'
  713. echo '3) '$HOME'/bin'$ARCHITECTURE
  714. echo ''
  715. echo 'Where shall the binaries be moved to (number or other path)? '
  716. read WHERE
  717. echo ''
  718. #}}}
  719. case $WHERE in
  720. #{{{  ORIPATH/binARCHITECTURE
  721.   0)
  722.   M4FLAGS="$M4FLAGS -DWHEREBIN=$ORIPATH/bin$ARCHITECTURE"
  723.   WHERE="$ORIPATH/bin$ARCHITECTURE"
  724.   ;;
  725. #}}}
  726. #{{{  /lbin
  727.   1)
  728.   M4FLAGS="$M4FLAGS -DWHEREBIN=/lbin"
  729.   WHERE="/lbin"
  730.   ;;
  731. #}}}
  732. #{{{  /usr/bin
  733.   2)
  734.   M4FLAGS="$M4FLAGS -DWHEREBIN=/usr/bin"
  735.   WHERE="/usr/bin"
  736.   ;;
  737. #}}}
  738. #{{{  $HOME/bin$ARCHITECTURE
  739.   3)
  740.   M4FLAGS="$M4FLAGS -DWHEREBIN=$HOME/bin$ARCHITECTURE"
  741.   WHERE="$HOME/bin$ARCHITECTURE"
  742.   ;;
  743. #}}}
  744. #{{{  *)
  745.   *)
  746.   M4FLAGS="$M4FLAGS -DWHEREBIN=$WHERE"
  747.   ;;
  748. #}}}
  749. esac
  750. #{{{  ask for ACCESSBIN
  751. echo $SUB_LIMIT
  752. echo 'Enter binary path for usage, empty path will use '$WHERE'. ->'
  753. read ACCESSBIN
  754. echo ''
  755. #}}}
  756. case x$ACCESSBIN in
  757. #{{{  
  758.   x)
  759.   ACCESSBIN=$WHERE
  760.   ;;
  761. #}}}
  762. #{{{  *)
  763.   *)
  764.   ;;
  765. #}}}
  766. esac
  767. M4FLAGS="$M4FLAGS -DACCESSBIN=$ACCESSBIN"
  768. #}}}
  769. #}}}
  770. #{{{  manual type
  771. echo $MAIN_LIMIT
  772. echo 'Manuals will be installed in '$ORIPATH'/man as roff sources (man1/man1.Z)'
  773. echo 'and/or as preformatted text (cat1/cat1.Z).'
  774. echo ''
  775. #{{{  prompt for man
  776. echo $SUB_LIMIT
  777. echo '0) no roff sources'
  778. echo '1) plain nroff sources in '$ORIPATH'/man/man1'
  779. echo '1) compressed nroff sources in '$ORIPATH'/man/man1.Z'
  780. echo ''
  781. echo 'How to install nroff source man pages? '
  782. read MANMAN
  783. echo ''
  784. case $MANMAN in
  785. #{{{  0 -> NONE
  786.   0)
  787.   ;;
  788. #}}}
  789. #{{{  1 -> man
  790.   1)
  791.   M4FLAGS="$M4FLAGS -DMAN_MAN"
  792.   ;;
  793. #}}}
  794. #{{{  2 -> manZ
  795.   2)
  796.   M4FLAGS="$M4FLAGS -DMAN_MANZ"
  797.   ;;
  798. #}}}
  799. #{{{  *)
  800.   *)
  801.   echo 'invalied answer'
  802.   exit 1
  803.   ;;
  804. #}}}
  805. esac
  806. #}}}
  807. #{{{  prompt for cat
  808. echo $SUB_LIMIT
  809. echo '0) no formatted man-pages'
  810. echo '1) formatted man-pages '$ORIPATH'/man/cat1'
  811. echo '1) compressed formatted man-pages '$ORIPATH'/man/cat1.Z'
  812. echo ''
  813. echo 'How to install formatted man-pages? '
  814. read MANCAT
  815. echo ''
  816. case $MANCAT in
  817. #{{{  0 -> NONE
  818.   0)
  819.   ;;
  820. #}}}
  821. #{{{  1 -> cat
  822.   1)
  823.   M4FLAGS="$M4FLAGS -DMAN_CAT"
  824.   ;;
  825. #}}}
  826. #{{{  2 -> catZ
  827.   2)
  828.   M4FLAGS="$M4FLAGS -DMAN_CATZ"
  829.   ;;
  830. #}}}
  831. #{{{  *)
  832.   *)
  833.   echo 'invalied answer'
  834.   exit 1
  835.   ;;
  836. #}}}
  837. esac
  838. #}}}
  839. #}}}
  840. #{{{  bindsource
  841. #{{{  ask for bin
  842. echo $MAIN_LIMIT
  843. echo '1) install binding sources'
  844. echo '2) do not install binding sources'
  845. echo '3) do not install binding sources, bindings'
  846. echo '   should be used to install the binaries in a multiple architecture'
  847. echo '   environment'
  848. echo ''
  849. echo 'Do you want to install bindings sources?'
  850. read BIND
  851. echo ''
  852. #}}}
  853. case $BIND in
  854. #{{{  all
  855.   1)
  856.   M4FLAGS="$M4FLAGS -Dbindsource=real_ocl_install -Dbindrc=realbindinstall"
  857.   ;;
  858. #}}}
  859. #{{{  no source
  860.   2)
  861.   M4FLAGS="$M4FLAGS -Dbindsource=  -Dbindrc=realbindinstall"
  862.   ;;
  863. #}}}
  864. #{{{  no source and rc's
  865.   3)
  866.   M4FLAGS="$M4FLAGS -Dbindsource=  -Dbindrc="
  867.   ;;
  868. #}}}
  869. #{{{  *)
  870.   *)
  871.   echo 'Invalid answer, bye :('; exit 1
  872.   ;;
  873. #}}}
  874. esac
  875. #}}}
  876. #{{{  regex
  877. #{{{  ask for regex
  878. echo $MAIN_LIMIT
  879. echo '1) Yes'
  880. echo '2) No'
  881. echo ''
  882. echo 'Do you want to use regular expressions? '
  883. read RE
  884. echo ''
  885. #}}}
  886. case $RE in
  887. #{{{  yes
  888.   1)
  889.   M4FLAGS="$M4FLAGS -Dregex -Dregbuff -DREG_COMP_BUFF=4"
  890.   ;;
  891. #}}}
  892. #{{{  no
  893.   2)
  894.   ;;
  895. #}}}
  896. #{{{  *)
  897.   *)
  898.   echo 'Invalid answer, bye :('; exit 1
  899.   ;;
  900. #}}}
  901. esac
  902. #}}}
  903. #{{{  start always/default file
  904. #{{{  ask for first file
  905. echo $MAIN_LIMIT
  906. echo 'If no filename is given on command line, use:'
  907. echo '1) prompt for filename, and exit on empty input'
  908. echo '2) prompt for filename, and use /dev/null on empty input'
  909. echo ''
  910. echo 'Which startup handling do you want (number or enter startup filename)?'
  911. read SF
  912. echo ''
  913. #}}}
  914. case $SF in
  915. #{{{  1
  916.   1)
  917.   ;;
  918. #}}}
  919. #{{{  2
  920.   2)
  921.   M4FLAGS="$M4FLAGS -Dstart_dev_null"
  922.   ;;
  923. #}}}
  924. #{{{  *)
  925.   *)
  926.   M4FLAGS="$M4FLAGS -Ddef_file_start -DDEF_FILE=$SF"
  927.   ;;
  928. #}}}
  929. esac
  930. #}}}
  931. #{{{  copyright
  932. #{{{  ask for copyright
  933. echo $MAIN_LIMIT
  934. echo '1) Never show the copyright message'
  935. echo '2) Copyright message can be switched off with command line option'
  936. echo '3) Always show the copyright message'
  937. echo ''
  938. echo 'Note: public available versions must have 2) or 3)!'
  939. echo 'Which copyright handling do you want? '
  940. read CP
  941. echo ''
  942. #}}}
  943. case $CP in
  944. #{{{  1
  945.   1)
  946.   M4FLAGS="$M4FLAGS -Dno_cp"
  947.   ;;
  948. #}}}
  949. #{{{  2
  950.   2)
  951.   M4FLAGS="$M4FLAGS -Dsw_cp"
  952.   ;;
  953. #}}}
  954. #{{{  3
  955.   3)
  956.   ;;
  957. #}}}
  958. #{{{  *)
  959.   *)
  960.   echo 'Invalid answer, bye :('; exit 1
  961.   ;;
  962. #}}}
  963. esac
  964. #}}}
  965. #{{{  non default switches
  966. #{{{  ask for switches
  967. echo $MAIN_LIMIT
  968. echo '1) no'
  969. echo '2) yes'
  970. echo ''
  971. echo 'Do you want to be asked about development configuration switches? '
  972. read HACK
  973. echo ''
  974. #}}}
  975. case $HACK in
  976.   2)
  977. #{{{  asserts
  978. #{{{  ask for asserts
  979.   echo $SUB_LIMIT
  980.   echo '1) no asserts'
  981.   echo '2) insert asserts into the code, for internal runtime checks'
  982.   echo ''
  983.   echo 'use asserts ? '
  984.   read ASSERT
  985.   echo ''
  986. #}}}
  987.   case $ASSERT in
  988. #{{{  use ASSERTS
  989.     2)
  990.     M4FLAGS="$M4FLAGS -DASSERT"
  991.     ;;
  992. #}}}
  993.   esac
  994. #}}}
  995. #{{{  hack path
  996. #{{{  ask for hack path
  997.   echo $SUB_LIMIT
  998.   echo '1) normal paths'
  999.   echo '2) add test path'\''s to Origami-rcpath and keybind lib-path'
  1000.   echo '   `pwd`/bindings:`pwd`/src/origami:`pwd`/src/h:fun'
  1001.   echo ''
  1002.   echo 'extend paths? '
  1003.   read HACK_PATH
  1004.   echo ''
  1005. #}}}
  1006.   case $HACK_PATH in
  1007. #{{{  use hack-paths
  1008.     2)
  1009.     M4FLAGS="$M4FLAGS -Dhack_path -DHACK_PATH="`pwd`"/bindings:"`pwd`"/src/origami:"`pwd`"/src/h"
  1010.     ;;
  1011. #}}}
  1012.   esac
  1013. #}}}
  1014. #{{{  profiling
  1015. #{{{  ask for profiling
  1016.   echo $SUB_LIMIT
  1017.   echo '1) no profiling'
  1018.   echo '2) include code for profiling'
  1019.   echo ''
  1020.   echo 'Do you want profiling? '
  1021.   read PROF
  1022.   echo ''
  1023. #}}}
  1024.   case $PROF in
  1025. #{{{  use profiling
  1026.     2)
  1027.     M4FLAGS="$M4FLAGS -Dprofile"
  1028.     ;;
  1029. #}}}
  1030.   esac
  1031. #}}}
  1032. #{{{  unsigned functions
  1033. #{{{  ask for unsigned
  1034.   echo $SUB_LIMIT
  1035.   echo '1) define ustrcpy, etc. as macros'
  1036.   echo '2) define usrtcpy, etc. as functions'
  1037.   echo ''
  1038.   echo 'How shall unsigned string functions be defined? '
  1039.   read UNSIGNED_FUNC
  1040.   echo ''
  1041. #}}}
  1042.   case $UNSIGNED_FUNC in
  1043. #{{{  use macros
  1044.     2)
  1045.     M4FLAGS="$M4FLAGS -Dunsigned_func"
  1046.     ;;
  1047. #}}}
  1048.   esac
  1049. #}}}
  1050. #{{{  malloc debug
  1051. #{{{  ask for malloc
  1052.   echo $SUB_LIMIT
  1053.   echo '1) use standard macro'
  1054.   echo '2) use a malloc packet, which supports the following command line options:'
  1055.   echo '   -@m, to display number of malloced bytes in the statusline '
  1056.   echo '        (instead of version)'
  1057.   echo '   -@ms<number>, to limit number of malloced bytes'
  1058.   echo '   -@mp<number>, to specify paket size for malloc (2^n)'
  1059.   echo '   -@mf<filename>, to specify file, which will contain a protocol of'
  1060.   echo '                   malloc/free calls and the number of malloced bytes.'
  1061.   echo ''
  1062.   echo 'Which malloc should be used? '
  1063.   read MALLOC_DEBUG
  1064.   echo ''
  1065. #}}}
  1066.   case $MALLOC_DEBUG in
  1067. #{{{  use macros
  1068.     2)
  1069.     M4FLAGS="$M4FLAGS -Dmalloc_debug"
  1070.     ;;
  1071. #}}}
  1072.   esac
  1073. #}}}
  1074. #{{{  ocl debug
  1075. #{{{  ask for ocl
  1076.   echo $SUB_LIMIT
  1077.   echo '1) default, no ocl debugging'
  1078.   echo '2) enable some OCL-debugging options:'
  1079.   echo '    -@os enables the display of the current stack depth'
  1080.   echo '    -@oS enables the display of the max. reached stack depth'
  1081.   echo '    -@od screen-off is disabled, display OFF instead'
  1082.   echo '    -@ot<delay>, sleep for <delay>/1000 seconds between each OCL command'
  1083.   echo '    -@of<name>, write stackdepth and executed commands on file <name>'
  1084.   echo '    -@ok<name>, write kbd-input on file <name>'
  1085.   echo ''
  1086.   echo 'Use OCL-debugging? '
  1087.   read OCL_DEBUG
  1088.   echo ''
  1089. #}}}
  1090.   case $OCL_DEBUG in
  1091. #{{{  debug ocl features
  1092.     2)
  1093.     M4FLAGS="$M4FLAGS -Docl_debug"
  1094.     ;;
  1095. #}}}
  1096.   esac
  1097. #}}}
  1098. #{{{  vir debug
  1099. #{{{  ask for vir
  1100.   echo $SUB_LIMIT
  1101.   echo '1) default virtual'
  1102.   echo '2) enable virtual with debugging capability, even if the default says no'
  1103.   echo '   -@v display size of virtual file in kbyte'
  1104.   echo '   -@vf<name> , name specifies a file, virtual linehandling dumbs a protocol to'
  1105.   echo ''
  1106.   echo 'which virtual handling? '
  1107.   read VIR_DEBUG
  1108.   echo ''
  1109. #}}}
  1110.   case $VIR_DEBUG in
  1111. #{{{  use vir debug
  1112.     2)
  1113.     M4FLAGS="$M4FLAGS -Dvir_debug"
  1114.     ;;
  1115. #}}}
  1116.   esac
  1117. #}}}
  1118.   ;;
  1119. esac
  1120. #}}}
  1121.  
  1122. #{{{  generate scripts
  1123. echo $MAIN_LIMIT
  1124. echo "generating scripts"
  1125. echo ''
  1126. #{{{  check, if dirname is available
  1127. if (dirname `pwd` >/dev/null)
  1128. then
  1129.   M4FLAGS="$M4FLAGS -Ddirname_cmd=dirname"
  1130. else
  1131.   M4FLAGS="$M4FLAGS -Ddirname_cmd=$SCRIPT_DIR/dirname"
  1132.   echo $SUB_LIMIT
  1133.   echo " dirname missing: using my own dirname! "
  1134.   echo ''
  1135.   cat >$SCRIPT_DIR/dirname <<\DIRNAME_END
  1136. #! /bin/sh
  1137. : &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  1138. #{{{  dirname_replace
  1139. #########################################################################
  1140. #    dirname        A substitute, for the deprived            #
  1141. #                                    #
  1142. #    Created by S.R. van den Berg, The Netherlands            #
  1143. #########################################################################
  1144. #$Id$
  1145.  
  1146. t=`expr "$1" : "\(.*/\)[^/]*$"`
  1147.  
  1148. if test -z "$t"
  1149. then
  1150.   echo .
  1151. else
  1152.   echo "$t"
  1153. fi
  1154.  
  1155. #}}}
  1156. DIRNAME_END
  1157.   chmod 755 $SCRIPT_DIR/dirname
  1158. fi
  1159. #}}}
  1160. #{{{  install_dir
  1161. if test $INSTALL_DIR = 1
  1162. then
  1163.    echo $SUB_LIMIT
  1164.    echo "Generating script: install_dir"
  1165.    echo ''
  1166.    cat >$SCRIPT_DIR/install_dir <<\SCRIPT_END
  1167. #! /bin/sh
  1168. : &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  1169. #{{{  get mode
  1170. mode="755"
  1171. if test x$1 = x-m
  1172. then
  1173.    shift
  1174.    mode=$1
  1175.    shift
  1176. fi
  1177. #}}}
  1178. #{{{  get list of needed dirs
  1179. dir_list=""
  1180. file=$1
  1181. while test 1
  1182. do
  1183. #{{{  break on .
  1184.    if test $file = "."
  1185.    then
  1186.       break
  1187.    fi
  1188. #}}}
  1189. #{{{  break on /
  1190.    if test $file = "/"
  1191.    then
  1192.       break
  1193.    fi
  1194. #}}}
  1195.    dir_list="$file $dir_list"
  1196.    file=`dirname $file`
  1197. done
  1198. #}}}
  1199. #{{{  mk all needed dirs
  1200. for i in $dir_list
  1201. do
  1202.    if test -d $i
  1203.    then
  1204.       :
  1205.    else
  1206.       mkdir $i
  1207.       chmod $mode $i
  1208.    fi
  1209. done
  1210. #}}}
  1211. SCRIPT_END
  1212.    chmod 755 $SCRIPT_DIR/install_dir
  1213. fi
  1214. #}}}
  1215. #{{{  install_file
  1216. if test $INSTALL_FILE = 1
  1217. then
  1218.    echo $SUB_LIMIT
  1219.    echo "Generating script: install_file"
  1220.    echo ''
  1221.    cat >$SCRIPT_DIR/install_file <<\SCRIPT_END
  1222. #! /bin/sh
  1223. : &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  1224. #{{{  get mode
  1225. mode="755"
  1226. if test x$1 = x-m
  1227. then
  1228.    shift
  1229.    mode=$1
  1230.    shift
  1231. fi
  1232. #}}}
  1233. ifile=$1
  1234. shift
  1235. file=$1
  1236. dir=$1
  1237. #{{{  get list of needed dirs
  1238. dir_list=""
  1239. while test 1
  1240. do
  1241. #{{{  break on .
  1242.    if test $file = "."
  1243.    then
  1244.       break
  1245.    fi
  1246. #}}}
  1247. #{{{  break on /
  1248.    if test $file = "/"
  1249.    then
  1250.       break
  1251.    fi
  1252. #}}}
  1253.    dir_list="$file $dir_list"
  1254.    file=`dirname $file`
  1255. done
  1256. #}}}
  1257. #{{{  mk all needed dirs
  1258. for i in $dir_list
  1259. do
  1260.    if test -d $i
  1261.    then
  1262.       :
  1263.    else
  1264.       mkdir $i
  1265.       chmod $mode $i
  1266.    fi
  1267. done
  1268. #}}}
  1269. cp $ifile $dir
  1270. chmod $mode $dir/`basename $ifile`
  1271. SCRIPT_END
  1272.    chmod 755 $SCRIPT_DIR/install_file
  1273. fi
  1274. #}}}
  1275. #{{{  install_bin
  1276. if test $INSTALL_BIN = 1
  1277. then
  1278.    echo $SUB_LIMIT
  1279.    echo "Generating script: install_bin"
  1280.    echo ''
  1281.    cat >$SCRIPT_DIR/install_bin <<\SCRIPT_END
  1282. #! /bin/sh
  1283. : &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  1284. #{{{  get mode
  1285. mode="755"
  1286. if test x$1 = x-m
  1287. then
  1288.    shift
  1289.    mode=$1
  1290.    shift
  1291. fi
  1292. #}}}
  1293. ifile=$1
  1294. shift
  1295. file=$1
  1296. dir=$1
  1297. #{{{  get list of needed dirs
  1298. dir_list=""
  1299. while test 1
  1300. do
  1301. #{{{  break on .
  1302.    if test $file = "."
  1303.    then
  1304.       break
  1305.    fi
  1306. #}}}
  1307. #{{{  break on /
  1308.    if test $file = "/"
  1309.    then
  1310.       break
  1311.    fi
  1312. #}}}
  1313.    dir_list="$file $dir_list"
  1314.    file=`dirname $file`
  1315. done
  1316. #}}}
  1317. #{{{  mk all needed dirs
  1318. for i in $dir_list
  1319. do
  1320.    if test -d $i
  1321.    then
  1322.       :
  1323.    else
  1324.       mkdir $i
  1325.       chmod $mode $i
  1326.    fi
  1327. done
  1328. #}}}
  1329. cp $ifile $dir
  1330. strip $dir/`basename $ifile`
  1331. chmod $mode $dir/`basename $ifile`
  1332. SCRIPT_END
  1333.    chmod 755 $SCRIPT_DIR/install_bin
  1334. fi
  1335. #}}}
  1336. #{{{  cattags
  1337. echo $SUB_LIMIT
  1338. echo "Generating script: cattags"
  1339. echo ''
  1340. cat >$SCRIPT_DIR/cattags <<SCRIPT_END
  1341. #! /bin/sh
  1342. : &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  1343.  
  1344. trap "/bin/rm -r -f cattags.awk" 0 1 2 3 15
  1345.  
  1346. #{{{  maybe show help
  1347. if test x\$1 = x-h
  1348. then
  1349.    echo "cattags files"
  1350.    exit
  1351. fi
  1352. #}}}
  1353.  
  1354. #{{{  maybe generate awk script
  1355. cat >cattags.awk <<\HERE
  1356. BEGIN { total=0 }
  1357. { if (dir[FILENAME]=="") {
  1358.      for(i=length(FILENAME);i>0;i--) {
  1359.         if (substr(FILENAME,i,1)=="/") {
  1360.            dir[FILENAME]=substr(FILENAME,1,i);
  1361.            use[FILENAME]=0
  1362.            break;
  1363.         }
  1364.      }
  1365.   }
  1366.   use[FILENAME]++
  1367.   total++
  1368.   e=\$0;
  1369.   while(e!="" && (c=substr(e,1,1))!=" " && c!="\t") e=substr(e,2);
  1370.   while((c=substr(e,1,1))==" " || c=="\t") e=substr(e,2);
  1371.   while(e!="" && (c=substr(e,1,1))!=" " && c!="\t") e=substr(e,2);
  1372.   print(\$1" "dir[FILENAME]\$2" "e) >"tags"
  1373. }
  1374. END {
  1375.    for (i in dir) printf("%4d tags in %s\n",use[i],i)
  1376.    printf("%4d tags in all\n",total)
  1377. }
  1378. HERE
  1379. #}}}
  1380.  
  1381. $AWK -f cattags.awk \$@
  1382. sort -o tags tags
  1383. SCRIPT_END
  1384. chmod 755 $SCRIPT_DIR/cattags
  1385. #}}}
  1386. #{{{  ocl2tag
  1387. echo $SUB_LIMIT
  1388. echo "Generating script: ocl2tag"
  1389. echo ''
  1390. cat >$SCRIPT_DIR/ocl2tag <<SCRIPT_END
  1391. #! /bin/sh
  1392. : &&O= || exec /bin/sh $0 $argv:q # we're in a csh, feed myself to sh
  1393.  
  1394. trap "/bin/rm -r -f ocl2tag.awk" 0 1 2 3 15
  1395.  
  1396. #{{{  maybe show help
  1397. if test x\$1 = x-h
  1398. then
  1399.    echo "ocl2tag files"
  1400.    exit
  1401. fi
  1402. #}}}
  1403.  
  1404. #{{{  maybe generate awk script
  1405. cat >ocl2tag.awk <<\HERE
  1406. BEGIN {
  1407.    state=0
  1408.    GO["deffun"]=1
  1409.    GO["defmac"]=3
  1410.    GO["defassembler"]=3
  1411.    GO["initfun"]=3
  1412. }
  1413. #{{{  count lines, get length for \$0..
  1414. { if (file[FILENAME]=="") {
  1415.      file[FILENAME]=" "
  1416.      lines=0
  1417.   }
  1418.   lines++
  1419.   off=1
  1420.   l=length(\$0)
  1421. }
  1422. #}}}
  1423. #{{{  start search
  1424. /(deffun)|(defmac)|(initfun)|(defassembler)/ {
  1425.    if (state!=0) {
  1426.       state=0
  1427.       print("aborting search: "FILENAME":"lines)
  1428.    }
  1429.    for (w in GO) {
  1430.       lw=length(w)
  1431.       for (off=1;off<=l-lw;off++)
  1432.          if (substr(\$0,off,lw)==w)
  1433.             break
  1434.       if (off<=l-lw) {
  1435.          state=GO[w]
  1436.          off+=lw
  1437.          break
  1438.       }
  1439.    }
  1440. }
  1441. #}}}
  1442. #{{{  arglist or not
  1443. state==1 {
  1444.    while (off<=l && (c=substr(\$0,off,1))==" ")
  1445.       off++
  1446.    if (off<l) {
  1447.       if (c=="(")
  1448.          state=2
  1449.       else
  1450.          state=3
  1451.    }
  1452. }
  1453. #}}}
  1454. #{{{  skip arglist
  1455. state==2 {
  1456.    while ((off<=l) && (substr(\$0,off,1)!=")"))
  1457.       off++
  1458.    if (off<=l) {
  1459.       state=3
  1460.       off++
  1461.    }
  1462. }
  1463. #}}}
  1464. #{{{  found name
  1465. state==3 {
  1466.    while (off<=l && substr(\$0,off,1)==" ")
  1467.       off++
  1468.    if (off<=l) {
  1469.       state=0
  1470.       tag=""
  1471.       while ((off<=l) && ((c=substr(\$0,off,1))!=" ") && (c!="(")) {
  1472.          off++
  1473.          tag=tag c
  1474.       }
  1475.       print(tag" "FILENAME" "lines) >"tags"
  1476.    }
  1477. }
  1478. #}}}
  1479. HERE
  1480. #}}}
  1481.  
  1482. $AWK -f ocl2tag.awk \$@
  1483. sort -o tags tags
  1484. SCRIPT_END
  1485. chmod 755 $SCRIPT_DIR/ocl2tag
  1486. #}}}
  1487. #}}}
  1488. #{{{  build Configfile
  1489. echo $MAIN_LIMIT
  1490. echo 'Ok, building Configfile ...'
  1491. echo $M4 $M4FLAGS
  1492. echo ''
  1493. $M4 $M4FLAGS >Configfile <<\CONFIG_END
  1494. #{{{  m4 rules
  1495. changequote([,])dnl
  1496. define([check],[ifdef([$1],[define([$1],[changequote({,})]{$[]1}[changequote([,])])define([no_$1],)],[define([$1],)define([no_$1],[changequote({,})]{$[]1}[changequote([,])])])dnl])dnl
  1497. check([linux])
  1498. check([sunos])
  1499. check([sunos_term_SYSV])
  1500. check([hpux])
  1501. check([sni_s600_20_uxpm])
  1502. check([ansi2kr])
  1503. check([gcc])
  1504. check([native])
  1505. check([native_ansi])
  1506. check([unsigned_func])
  1507. check([malloc_debug])
  1508. check([ocl_debug])
  1509. check([vir_debug])
  1510. check([hack_path])
  1511. check([MGR])
  1512. check([regex])
  1513. check([regbuff])
  1514. check([profile])
  1515. check([scrbuff])
  1516. check([terminfo])
  1517. check([def_file_start])
  1518. check([start_dev_null])
  1519. check([no_cp])
  1520. check([sw_cp])
  1521. check([dec_alpha_axp_osf_1])
  1522. check([mkdep])
  1523. check([ASSERT])
  1524. check([MAN_MAN])
  1525. check([MAN_MANZ])
  1526. check([MAN_CAT])
  1527. check([MAN_CATZ])
  1528. #used during m4-run
  1529. #}}}
  1530. #{{{  default and paths
  1531. [default:    all]
  1532. []
  1533. [SCRIPT_DIR=    ]SCRIPT_DIR
  1534. []
  1535. [TERMINFO_DIR=    ]terminfo_dir_name
  1536. [TERMCAP_DIR=    ]termcap_dir_name
  1537. []
  1538. [BIN_PATH=    ]WHEREBIN
  1539. [ORIGAMI_PATH=    ]WHEREHOME
  1540. [ACCESS_ORIGAMI_PATH=    ]ACCESSHOME
  1541. [MAN_PATH=    ]$(ORIGAMI_PATH)/man
  1542. hack_path([HACK_PATH=    ]HACK_PATH)no_hack_path([#HACK_PATH=])
  1543. [ORIGAMI_RC_PATH=.:~:$(ACCESS_ORIGAMI_PATH)]hack_path([:$(HACK_PATH)])
  1544. [KBD_LIB_PATH=    .:$(ACCESS_ORIGAMI_PATH)/bindings/fun:$(ACCESS_ORIGAMI_PATH)/bindings]hack_path([:fun])
  1545. []
  1546. [BINDSOURCEINSTALL=]bindsource
  1547. [BINDRCINSTALL=    ]bindrc
  1548. [MAN_INSTALL_TARGET=]MAN_MAN([ man_install])MAN_MANZ([ manz_install])MAN_CAT([ cat_install])MAN_CATZ([ catz_install])
  1549. #}}}
  1550. #{{{  os independent files/cpp-switches
  1551. #{{{  additional files
  1552. [LIB_CONFIG_ADDS=    ]regex([ bregex.o])unsigned_func([ string.o])
  1553. [ORI_CONFIG_ADDS=    ]scrbuff([scrbuff.o])
  1554. ocl_debug([DEBUG_H=    ../viewrc/name.h])
  1555. #}}}
  1556. #{{{  ori flags
  1557. [ORI_CONFIG_FLAGS=    $(LIB_CPP_FLAGS) \]
  1558. start_dev_null([ -DALWAYS_START])def_file_start([ -DDEFAULT_FILE=\"]DEF_FILE[\"])[ \]
  1559. [ ]regex([-DREGEXP -DRE_CONF]regbuff([ -DREG_COMP_BUFF=]REG_COMP_BUFF))[ \]
  1560. unsigned_func([ -DUNSIGNED_FUNC])malloc_debug([ -DMALLOC_DEBUG])ocl_debug([ -DOCL_DEBUG])vir_debug([ -DVIRTUAL -DVIR_DEBUG])[ \]
  1561. [ ]scrbuff([-DUSE_SCRBUFF])[ \]
  1562. [ ]no_cp([-DNO_MSG])sw_cp([-DSW_MSG])[ \]
  1563. [ ]ASSERT([-DASSERT])[ \]
  1564. [ -DORIGAMI_RC_PATH=\"$(ORIGAMI_RC_PATH)\" \]
  1565. [ -DKBD_PATH=\"$(KBD_LIB_PATH)\" \]
  1566. [ -DDOC_MSG=\"$(ACCESS_ORIGAMI_PATH)\"]
  1567. #}}}
  1568. #{{{  docs
  1569. [DOCS=        manual.ascii.Z intro.ascii]
  1570. #}}}
  1571. #}}}
  1572. #{{{  os dependent compiler rules/variables
  1573. #{{{  linux
  1574. linux(
  1575. [DIRNAME=    ]dirname_cmd
  1576. [BASENAME=    basename]
  1577. [AR=        ar qc]
  1578. [RANLIB=    ranlib]
  1579. [CC=        gcc]
  1580. [LD=        gcc]
  1581. no_mkdep([GEN_DEPEND=    gcc -MM $(CPPFLAGS) *.c >>dependencies])
  1582. mkdep([GEN_DEPEND=    mkdep -d *.c >>dependencies])
  1583. [AWK=        ]AWK
  1584. [M4=        ]M4
  1585. [BIN_INSTALL=    install -s -c]
  1586. [DIR_INSTALL=    install -d -c]
  1587. [FILE_INSTALL=    install -c]
  1588. [CPPFLAGS=    -I.. ]MGR([-I]MGRDIR[/include -DMGR ])[\]
  1589. [-DFILEC \]
  1590. [-DXTERM \]
  1591. [-DRC_BUFFER_SIZE=8192 \]
  1592. [-DMAC_BUFF_SIZE=8192 \]
  1593. [-DDIREDT -DDIREDT_PATH=\"]ACCESSBIN[\" \]
  1594. [$(ORI_CONFIG_FLAGS)]
  1595. [CFLAGS=    -Wall -O2 -fomit-frame-pointer]
  1596. [TERMCAP_LIBS=    -ltermcap]
  1597. MGR([LIBS=    ]MGRDIR[/lib/libmgr.a])
  1598. [ADD_LIB_FILES= $(LIB_CONFIG_ADDS)]
  1599. [ADD_ORI_FILES=    $(ORI_CONFIG_ADDS)]
  1600. [ADD_DIRFOLD_FILES=]
  1601. [TERMINALS=    con80x25 console vt100 vt102 vt125 vt200 vt220 xterm ]MGR([mgr-linux])
  1602. [KEYBINDFLAGS=    ]MGR([-M mgr-linux ])[-M xterm]
  1603. [lint_test:]
  1604. [        @echo "no lint possible";exit 1;]
  1605. )no_linux([#not used])
  1606. #}}}
  1607. #{{{  sunos
  1608. sunos(
  1609. [DIRNAME=    ]dirname_cmd
  1610. [BASENAME=    basename]
  1611. [AR=        ar qc]
  1612. [RANLIB=    ranlib]
  1613. [CC=        ]gcc([g])[cc]
  1614. [LD=        ]gcc([g])[cc]
  1615. [GEN_DEPEND=    ]gcc([$(CC) $(CPPFLAGS) -MM *.c >>dependencies])native([makedepend $(CPPFLAGS) -a -f dependencies *.c])
  1616. [AWK=        ]AWK
  1617. [M4=        ]M4
  1618. [BIN_INSTALL=    install -s -c]
  1619. [DIR_INSTALL=    install -d]
  1620. [FILE_INSTALL=    install -c]
  1621. [CPPFLAGS=      \]
  1622. [ -I.. \]
  1623. [ ]MGR([-I]MGRDIR[/include -DMGR -DMGR_MOUSE_NAME=\"mgr\"])[ \]
  1624. [ -DPOSIX_SOURCE \]
  1625. [ -DSTRERROR_MIS \]
  1626. [ ]terminfo([-DTERMINFO -DINC_CURSES -DINC_TERM])[ \]
  1627. [ ]gcc([-DUSLEEP_MIS -D_POSIX_SOURCE -D_POSIX_PATH_MAX=255 -D`mach`])[ \]
  1628. [ ]native([-Dconst=  -DVARARGS])[ \]
  1629. [ ]terminfo(sunos_term_SYSV([-I/usr/5include]))[ \]
  1630. [ -DMAIL_SENDMAIL=\"/usr/lib/sendmail\" \]
  1631. [ -DFILEC \]
  1632. [ -DXTERM \]
  1633. [ -DRC_BUFFER_SIZE=8192 \]
  1634. [ -DMAC_BUFF_SIZE=8192 \]
  1635. [ -DDIREDT -DDIREDT_PATH=\"]ACCESSBIN[\" \]
  1636. [ $(ORI_CONFIG_FLAGS)]
  1637. [CFLAGS=    ]gcc([-O2 -Wall])native([-O ])[ $(CPPFLAGS)]
  1638. [LDFLAGS=       ]gcc(profile([ -p]))terminfo([ -L/usr/5lib])
  1639. [ADD_LIB_FILES= $(LIB_CONFIG_ADDS) strerror.o]
  1640. [ADD_ORI_FILES=    $(ORI_CONFIG_ADDS)]
  1641. [ADD_DIRFOLD_FILES=]
  1642. [ADD_AUTO_FILES=]
  1643. [TERMCAP_LIBS=    ]terminfo(sunos_term_SYSV([-lcurses ]))[-ltermcap]
  1644. [LIBS=    ]MGR(MGRDIR[/lib$(ARCHITECTURE)/libmgr.a])
  1645. [KEYBINDFLAGS=    ]ocl_debug([-c ])
  1646. [TERMINALS=    xterm 'sun' 'hp' 'hpterm' vt100 vt102 vt200 vt220]MGR([ mgr])
  1647. [lint_test:]
  1648. [        @echo "no lint possible";exit 1;]
  1649. )no_sunos([#not used])
  1650. #}}}
  1651. #{{{  hpux
  1652. hpux(
  1653. [DIRNAME=    ]dirname_cmd
  1654. [BASENAME=    basename]
  1655. [AR=        ar qc]
  1656. [RANLIB=    @echo "ranlib: Already done by $(AR)"]
  1657. [CC=        ]gcc([gcc])no_gcc([cc])
  1658. [LD=        ]gcc([gcc])no_gcc([cc])
  1659. [GEN_DEPEND=    ]gcc([$(CC) $(CPPFLAGS) -MM *.c >>dependencies])native([makedepend $(CPPFLAGS) -a -f dependencies *.c])native_ansi([makedepend $(CPPFLAGS) -a -f dependencies *.c])
  1660. [AWK=        ]AWK
  1661. [M4=        ]M4
  1662. [BIN_INSTALL=    ]SCRIPT_DIR[/install_bin]
  1663. [DIR_INSTALL=    ]SCRIPT_DIR[/install_dir]
  1664. [FILE_INSTALL=    ]SCRIPT_DIR[/install_file]
  1665. [CPPFLAGS=    \]
  1666. [ -I.. \]
  1667. [ ]MGR([-I]MGRDIR[/include -DMGR -DMGR_MOUSE_NAME=\"mgr\"])[ \]
  1668. [ -DUSLEEP_MIS -DSELECT_USLEEP \]
  1669. [ ]gcc([-D_POSIX_SOURCE -DTEMPNAM_MIS -DPOPEN_MIS -DPCLOSE_MIS -DGETPWENT_MIS])[ \]
  1670. [ ]native_ansi([-D_POSIX_SOURCE -DTEMPNAM_MIS -DPOPEN_MIS -DPCLOSE_MIS -DGETPWENT_MIS])[ \]
  1671. [ ]native([-Dconst=  -DVARARGS])[ \]
  1672. [ -D_INCLUDE_HPUX_SOURCE -D_INCLUDE_XOPEN_SOURCE \]
  1673. [ -DMAIL_SENDMAIL=\"/usr/lib/sendmail\" \]
  1674. [ -DXTERM \]
  1675. [ ]terminfo([-DTERMINFO -DINC_CURSES -DINC_TERM -DSMALL_TERMINFO])[ \]
  1676. [ -DFILEC \]
  1677. [ -DRC_BUFFER_SIZE=8192 \]
  1678. [ -DMAC_BUFF_SIZE=8192 \]
  1679. [ -DDIREDT -DDIREDT_PATH=\"]ACCESSBIN[\" \]
  1680. [ $(ORI_CONFIG_FLAGS)]
  1681. [CFLAGS=    ]gcc([-O2 -ansi -pedantic -Wall]profile([ -p]))native_ansi([-Aa +ESlit +O3]profile([ -G]))native([-O]profile([ -G]))[ $(CPPFLAGS)]
  1682. [LDFLAGS=    ]gcc(profile([-p]))native_ansi(profile([-G]))native(profile([-G]))
  1683. [ADD_LIB_FILES= $(LIB_CONFIG_ADDS) usleep.o]
  1684. [ADD_ORI_FILES=    $(ORI_CONFIG_ADDS)]
  1685. [ADD_DIRFOLD_FILES=]
  1686. [TERMCAP_LIBS=    ]no_terminfo([-ltermcap])terminfo([-lcurses])
  1687. [LIBS=        ]MGR(MGRDIR[/lib$(ARCHITECTURE)/libmgr.a])
  1688. [TERMINALS=    xterm 'sun' 'hp' 'hpterm' vt100 vt102 vt200 vt220]MGR([ mgr])
  1689. [KEYBINDFLAGS=    ]ocl_debug([-c ])
  1690. native_ansi(
  1691. [LINT=        lint]
  1692. [LINTFILES=    *.c]
  1693. [LINTFLAGS=      -s -DLINT -Aa]
  1694. [lint_test:]
  1695. []
  1696. )
  1697. gcc(
  1698. [lint_test:]
  1699. [        @echo "no lint possible";exit 1;])
  1700. native(
  1701. [lint_test:]
  1702. [        @echo "no lint possible";exit 1;])
  1703. )no_hpux([#not used])
  1704. #}}}
  1705. #{{{  sni s600-20 uxpm
  1706. sni_s600_20_uxpm(
  1707. [DIRNAME=    ]dirname_cmd
  1708. [BASENAME=    basename]
  1709. [AR=        ar qc]
  1710. [RANLIB=    ranlib]
  1711. [CC=        cc]
  1712. [LD=        cc]
  1713. [GEN_DEPEND=    makedepend $(CPPFLAGS) -a -f dependencies *.c]
  1714. [AWK=        ]AWK
  1715. [M4=        ]M4
  1716. [BIN_INSTALL=    install -s -c]
  1717. [DIR_INSTALL=    install -d]
  1718. [FILE_INSTALL=    install -c]
  1719. [CPPFLAGS=       \]
  1720. [ -I.. \]
  1721. [ -DMAIL_NO_S \]
  1722. [ -DXTERM \]
  1723. [ -DNOSYSEXIT \]
  1724. [ -DFILEC \]
  1725. [ -DRC_BUFFER_SIZE=8192 \]
  1726. [ -DMAC_BUFF_SIZE=8192 \]
  1727. [ -DDIREDT -DDIREDT_PATH=\"]ACCESSBIN[\" \]
  1728. [ $(ORI_CONFIG_FLAGS)]
  1729. [CFLAGS=    $(CPPFLAGS) -O -v l]
  1730. [LDFLAGS=]
  1731. [ADD_LIB_FILES= $(LIB_CONFIG_ADDS)]
  1732. [ADD_ORI_FILES=    $(ORI_CONFIG_ADDS)]
  1733. [ADD_DIRFOLD_FILES=]
  1734. [TERMCAP_LIBS=    -lcurses -L/usr/ucblib -lucb]
  1735. [TERMINALS=    xterm 'sun' 'hp' 'hpterm' vt100 vt102 vt200 vt220]MGR([ mgr])
  1736. [KEYBINDFLAGS=    ]ocl_debug([-c ])
  1737. [lint_test:]
  1738. [        @echo "no lint possible";exit 1;]
  1739. )no_sni_s600_20_uxpm([#not used])
  1740. #}}}
  1741. #{{{  dec_alpha_axp_osf_1
  1742. dec_alpha_axp_osf_1(
  1743. [DIRNAME=    ]dirname_cmd
  1744. [BASENAME=    basename]
  1745. [AR=        ar qc]
  1746. [RANLIB=    ranlib]
  1747. [CC=        ]gcc([gcc])native([cc])
  1748. [LD=        ]gcc([gcc])native([cc])
  1749. [GEN_DEPEND=    makedepend $(CPPFLAGS) -a -f dependencies *.c]
  1750. [GEN_DEPEND=    ]gcc([$(CC) $(CPPFLAGS) -MM *.c >>dependencies])native([makedepend $(CPPFLAGS) -a -f dependencies *.c])
  1751. [AWK=        awk]
  1752. [M4=        m4]
  1753. [BIN_INSTALL=    ]SCRIPT_DIR[/install_bin]
  1754. [DIR_INSTALL=    ]SCRIPT_DIR[/install_dir]
  1755. [FILE_INSTALL=    ]SCRIPT_DIR[/install_file]
  1756. [CPPFLAGS=    \]
  1757. [ -I.. \]
  1758. [ -DMAIL_SENDMAIL=\"/usr/sbin/sendmail\" \]
  1759. [ -DNO_GETOPT_H \]
  1760. [ -DTERMINFO -DINC_CURSES -DINC_TERM -DSMALL_TERMINFO \]
  1761. [ -DXTERM \]
  1762. [ -DFILEC \]
  1763. [ -DRC_BUFFER_SIZE=8192 \]
  1764. [ -DMAC_BUFF_SIZE=8192 \]
  1765. [ -DDIREDT -DDIREDT_PATH=\"]ACCESSBIN[\" \]
  1766. [ $(ORI_CONFIG_FLAGS)]
  1767. [CFLAGS=    $(CPPFLAGS)]
  1768. [LDFLAGS=]
  1769. [ADD_LIB_FILES= $(LIB_CONFIG_ADDS)]
  1770. [ADD_ORI_FILES=    $(ORI_CONFIG_ADDS)]
  1771. [ADD_DIRFOLD_FILES=]
  1772. [TERMCAP_LIBS=    -lcurses]
  1773. [TERMINALS=    xterm 'sun' 'hp' 'hpterm' vt100 vt102 vt200 vt220]MGR([ mgr])
  1774. [KEYBINDFLAGS=    ]ocl_debug([-c ])
  1775. [LINT=        lint]
  1776. [LINTFILES=    *.c]
  1777. [LINTFLAGS=    -MA -DLINT]
  1778. [lint_test:]
  1779. []
  1780. )no_dec_alpha_axp_osf_1([#not used])
  1781. #}}}
  1782. #{{{  maybe use a special ansi2kr filter
  1783. ansi2kr(
  1784. [UNPROTO=    ]UNPROTO
  1785. [.c.o:]
  1786. [        @echo $@]
  1787. [        $(UNPROTO) $(CPPFLAGS) <$< >$*.u.c]
  1788. [        $(CC) $(CFLAGS) -c -o $@ $*.u.c]
  1789. [        rm $*.u.c]
  1790. )no_ansi2kr([#not used])
  1791. #}}}
  1792. #}}}
  1793. #{{{  check common files
  1794. [dummy_target:]
  1795. [$(COMMON_HDRS) $(COMMON_OBJS) ../lib/orilib.a:]
  1796. [        @cd $(@D);$(MAKE) $(@F)]
  1797. [check_common:]
  1798. [        @for i in $(COMMON_HDRS) $(COMMON_OBJS) dummy_target; do cd `$(DIRNAME) $$i`;$(MAKE) `$(BASENAME) $$i`; done]
  1799. #}}}
  1800. CONFIG_END
  1801. #}}}
  1802.  
  1803. #{{{  say bye
  1804. echo $MAIN_LIMIT
  1805. echo 'After checking if Configfile suits your taste, run "make depend" to create'
  1806. echo 'the dependencies, then can use "make" or "make install", either from this'
  1807. echo 'directory or from subdirectories (then directories have to be installed'
  1808. echo 'before using "make dir_install"!)'
  1809.  
  1810. exit 0
  1811. #}}}
  1812.